{include file="common/header" /}
<div class="container demo">
    <div class="content">
        <div id="large-header" class="large-header">
            <canvas id="demo-canvas"></canvas>
            <div class="logo_box">
                <h3><img src="/static/images/grapes.png"></h3>
                <form class="layui-form" action="" method="post">
                    <div class="input_outer">
                        <span class="u_user"></span>
                        <input type="text" name="mobile" class="text" style="color: #FFFFFF !important"
                               lay-verify="required" autocomplete="off" placeholder="请输入账户：">
                    </div>
                    <div class="input_outer">
                        <span class="us_uer"></span>
                        <input type="password" name="password" class="text"
                               style="color: #FFFFFF !important; position:absolute; z-index:100;"
                               autocomplete="new-password" placeholder="请输入密码：">
                    </div>
                    <div class="input_outer" style="display:none;" id="captcha_div">
                        <span class="us_pass"></span>
                        <input type="text" name="captcha" class="text" autocomplete="off"
                               style="color: #FFFFFF !important; position:absolute; z-index:100; width: 110px;"
                               id="captcha_ipt" placeholder="请输入验证码：">
                        <div class="captcha">
                            <img src="{:captcha_src()}" id="captcha_img" onclick="setCaptcha()" title="点击更换验证码"
                                 alt="captcha" style="max-width:150px;cursor:pointer;"/>
                        </div>
                    </div>
                    <div class="mb2"><a class="act-but submit" href="javascript:;" lay-submit
                                        lay-filter="password_login" style="color: #FFFFFF">登录</a></div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['element', 'form'], function () {
        //密码登陆
        layui.form.on('submit(password_login)', function (data) {
            $.ajax({
                type: "POST",
                url: "{:url('admin/common/login')}",
                data: data.field,
                success: function (data) {
                    if (data.status) {
                        layer.msg('登陆成功，跳转中...');
                        setTimeout("window.location.href='" + data.data + "'; ", 1500);
                    } else {
                        if (data.data == '10013' || data.data == '10012') {
                            $('#captcha_div').show();
                        }
                        setCaptcha();
                        layer.msg(data.msg);
                    }
                }
            });
            return false;
        });
    });

    //更改验证码图片
    function setCaptcha() {
        $('#captcha_ipt').val("");
        var timestamp = new Date().getTime();
        $('#captcha_img').attr('src', '{:captcha_src()}?' + timestamp);
    }
</script>
<script src="/static/js/html5.js"></script>
<script src="/static/js/TweenLite.min.js"></script>
<script src="/static/js/EasePack.min.js"></script>
<script src="/static/js/rAF.js"></script>
<script src="/static/js/demo.js"></script>
{include file="common/footer" /}